package com.ideaaedi.extspringcache.test.test4caffeign.loader4refresh;

import com.github.benmanes.caffeine.cache.CacheLoader;
import com.ideaaedi.extspringcache.annotation.Caffeine;
import org.springframework.lang.NonNull;
import org.springframework.stereotype.Component;

import java.time.LocalTime;
import java.time.format.DateTimeFormatter;

/**
 * 测试 {@link Caffeine#refreshAfterWrite()}
 * <br/>
 *
 * @author JustryDeng
 * @since 2020/11/9 21:23:23
 */
@Component
public class MyCacheLoader implements CacheLoader<Object, Object> {

    @Override
    public Object load(@NonNull Object key) {
        LocalTime localTime = LocalTime.now();
        System.err.println("进MyCacheLoader了");
        return key + " - obj - " + localTime.format(DateTimeFormatter.ofPattern("HH:mm:ss"));
//        return null;
    }
}
